{% extends 'backend/index.html' %}
{% load staticfiles %}
{% block title %}
    <title>添加文章-后台管理中心</title>
{% endblock %}
{% block styles %}
    <script charset="utf-8" src="/static/kindeditor/kindeditor-all-min.js"></script>
    <script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('#kindeditor', {
        allowImageUpload : true,
            resizeType:0,
          uploadJson:'/admin/upload/kindeditor',
            /* items : [
           'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic',
    'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright',
    'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'] */
      });
    });
</script>
{% endblock %}
{% block content %}
<form class="form-horizontal" method="post" enctype="multipart/form-data" action="./article_add" style="width: 80%;">
{% csrf_token %}
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">标题</label>
    <div class="col-sm-10">
      <input type="text" name="title" class="form-control" placeholder="文章标题不超过20字！">
    </div>
  </div>
    <div class="row" style="margin-bottom: 15px;">
         <label for="inputEmail3" class="col-sm-2 control-label">作者</label>
    <div class="col-xs-2">
      <input type="text" class="form-control" name="author" placeholder="作者">
    </div>
        <label for="inputEmail3" class="col-sm-2 control-label">来源</label>
  <div class="col-xs-2">
      <input type="text" class="form-control" id="inputEmail3" placeholder="来源">
    </div>

  </div>

    <div class="row" style="margin-bottom: 15px;">
    <label for="inputEmail3" class="col-sm-2 control-label">标签</label>
    <div class="col-sm-2">
        <select multiple name="tag" class="form-control" style="height: 60px;">
            {% for row in tags %}
                <option value="{{ row.id }}">{{ row.name }}</option>
            {% endfor %}
</select>
    </div>
        <label for="inputEmail3" class="col-sm-2 control-label">缩略图</label>
      <div class="col-xs-5">
      <input type="file"  name="img" placeholder=""><label>图片不要超过2M,格式仅支持jpg、png、gif等。</label>
    </div>
  </div>

    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">摘要</label>
    <div class="col-sm-10">
      <textarea class="form-control" rows="2" name="summary" placeholder="文章摘要，不超过100字！"></textarea>
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">内容</label>
    <div class="col-sm-10">
        <textarea class="form-control" rows="40" name="content" id="kindeditor"></textarea>
    </div>
  </div>
     <div class="row" style="margin-bottom: 15px;">
         <label for="inputEmail3" class="col-sm-2 control-label">分类</label>
    <div class="col-xs-2">
        <select class="form-control" name="classify">
            {% for row in classify %}
                <option value="{{ row.id }}">{{ row.name }}</option>
            {% endfor %}
        </select>
    </div>
        <label for="inputEmail3" class="col-sm-2 control-label">发布时间</label>
  <div class="col-xs-2">
      <input type="date" class="form-control" name="create_date" id="mydate" value="123456" />
      <script type="text/javascript">
         function wol(){
        var mydateInput = document.getElementById("mydate");
        var date = new Date();
        var dateString = date.getFullYear()+"/"+(date.getMonth()+1)+"/"+date.getDate();
        mydateInput.value=dateString;
         }
    </script>
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
         <button type="submit" class="btn btn-default">保存</button>
        <button type="reset" class="btn btn-default">取消</button>
    </div>
  </div>
</form>
{% endblock %}
